<?php

namespace ZzDylan\ZzAdmin;

use Illuminate\Support\ServiceProvider;

class AdminServiceProvider extends ServiceProvider {

    protected $commands = [
        'ZzDylan\ZzAdmin\Console\InstallCommand',
    ];

    public function boot() {
        if (file_exists($routes = admin_path('routes.php'))) {
            $this->loadRoutesFrom($routes);
        }
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
        if ($this->app->runningInConsole()) {
            $this->publishes([__DIR__ . '/../config' => config_path()], 'laravel-admin-config');
            $this->publishes([__DIR__.'/../resources/assets' => public_path('vendor/zz-admin')], 'zz-admin-assets');
        }
    }

    public function register() {
        $this->commands($this->commands);
    }

}
